HEX
Server: LiteSpeed
System: Linux venus 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
User: axxoncom (1007)
PHP: 8.3.19
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/axxoncom/domains/missherbes.com/public_html/wp-content/plugins/otter-blocks/inc/Tracker.php
<?php
/**
 * Class for telemetry.
 *
 * @package ThemeIsle
 */

namespace ThemeIsle\GutenbergBlocks;

/**
 * Class Tracker
 */
class Tracker {

	/**
	 * Tracking URL.
	 *
	 * @var string
	 */
	public static $track_url = 'https://api.themeisle.com/tracking/events';

	/**
	 * Send data to the server if the user has opted in.
	 *
	 * @param array<array> $events Data to track.
	 * @param array        $options Options.
	 * @return void
	 */
	public static function track( $events, $options = array() ) {

		if ( ! self::has_consent() && ( ! isset( $options['hasConsent'] ) || ! $options['hasConsent'] ) ) {
			return;
		}

		try {
			$payload = array();

			$license = apply_filters( 'product_otter_license_key', 'free' );

			if ( 'free' !== $license ) {
				$license = wp_hash( $license );
			}

			foreach ( $events as $event ) {
				$payload[] = array(
					'slug'    => 'otter',
					'site'    => get_site_url(),
					'license' => $license,
					'data'    => $event,
				);
			}

			$args = array(
				'headers' => array(
					'Content-Type' => 'application/json',
				),
				'body'    => wp_json_encode( $payload ),
			);

			wp_remote_post( self::$track_url, $args );
		} finally {
			return;
		}
	}

	/**
	 * Check if the user has consented to tracking.
	 *
	 * @return bool
	 */
	public static function has_consent() {
		return (bool) get_option( 'otter_blocks_logger_flag', false );
	}
}